package cn.marinda.resturants.service;

import cn.marinda.resturants.entity.Permission;
import cn.marinda.resturants.entity.User;
import cn.marinda.resturants.global.Pages;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/** PermissionService 权限服务层
 *
 * @date 2021/12/2
 * @author Marinda
 * @version 1.0
 *
 */
public interface PermissionsService extends IService<Permission> {


    /**
     * 选择uid许可
     *
     * @param uid uid
     * @return {@link Permission}
     */
    Permission selectPermissionUid(String uid);

    /** 分页User
     *
     * @param page 传输page数据
     * @return 迭代的page
     */
    IPage<Permission> selectPages(Pages<?> page);


    /** 查询所有权限
     *
     * @return 权限列表
     */
    List<Permission> queryList();

    /** 添加一个权限
     *
     * @param permission 权限
     * @return 结果
     */
    boolean addPermission(Permission permission);

    /** 删除一个权限
     *
     * @param uid uid
     * @return 结果
     */
    boolean deletePermission(long uid);

    /** 子权限
     *
     * @param uid uid
     * @return 子权限
     */
    long selectChildUid(long uid);

    /** 查询名字
     *
     * @param uid uid
     * @return 名字
     */
    String selectName(long uid);

    /** 查询父权限
     *
     * @param uid uid
     * @return 父级权限
     */
    long selectParentUid(long uid);

    /** 乐观锁修改权限
     *
     * @param permission 权限
     * @return 结果
     */
    boolean updatePermission(Permission permission);

}
